package com.yimu.ymblog.web.controller;

import com.yimu.ymblog.common.aspect.ApiOperationLog;
import com.yimu.ymblog.common.domain.web.vo.other.UpdateUserInfoReqVO;
import com.yimu.ymblog.common.utils.Response;
import com.yimu.ymblog.web.service.OtherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(tags = "其他功能接口")
public class OtherController {

    @Autowired
    private OtherService otherService;

    @GetMapping("/hot")
    @ApiOperation(value = "获取各大平台热搜")
    @ApiOperationLog(description = "获取各大平台热搜")
    public Response hot(String type){
        return otherService.hot(type);
    }

    @GetMapping("/webSiteInfo")
    @ApiOperation(value = "网站相关信息", httpMethod = "GET", response = Response.class, notes = "网站相关信息")
    public Response getWebSiteInfo(){
        return otherService.getWebSiteInfo();
    }

    @RequestMapping(value = "/report",method = RequestMethod.GET)
    @ApiOperation(value = "增加访问量和访客量", httpMethod = "GET", response = Response.class, notes = "增加访问量和访客量")
    public Response report(){
        return otherService.report();
    }

    @RequestMapping(value = "/updateUserInfo",method = RequestMethod.POST)
    @ApiOperation(value = "更改用户资料信息", httpMethod = "POST", response = Response.class, notes = "更改用户资料信息")
    public Response updateUserInfo(@RequestBody @Validated UpdateUserInfoReqVO updateUserInfoReqVO){
        return otherService.updateUserInfo(updateUserInfoReqVO);
    }

}
